﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using AspNetCs.Model;
using AspNetCs.Common;
using AspNetCs.Bll;

public partial class Master_Admin_ManageMusic : Admin_BasePage
{
    protected City city = new City();
    MusicBLL bll = Music_Bll.CreateNew;
    protected void Page_Load(object sender, EventArgs e)
    {
        IsExit();
        if (!IsPostBack)
        {
            dataBind();
        }

    }



    protected void dataBind()
    {
        string cmdText = "select * from Music order by id desc";
        AspNetCs.Common.DataPagesOperate operate = new DataPagesOperate();

        operate.BindRepeater(cmdText, AspNetPager1, "id desc", "id", rptNetMuList);


    }


    protected void rptNetMuList_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        LinkButton lbtn = null;
        try
        {
            int count = 0;
            string id = "";
            int NetMuId = 0;
            if (e.CommandName == "delete")
            {
                lbtn = e.Item.FindControl("btn_del") as LinkButton;
                id = lbtn.CommandArgument;
                NetMuId = Convert.ToInt32(id);
                bool bo = false;

                count = bll.DeleteMusic(NetMuId);
                bo = count > 0 ? true : false;
                if (bo)
                {
                    showMessage("deleteSucce", "删除成功");
                    dataBind();
                }
                else
                {
                    showMessage("deleteFaith", "删除失败");
                    dataBind();
                }
            }
         
        }
        catch
        {
            //new CustomException(ex);
        }
    }

    protected void AspNetPager1_PageChanged(object sender, EventArgs e)
    {
        dataBind();
    }
}
